import { S, U, getRequestId, mapField } from '../../lib/backend'
import Q from 'q'
import axios from 'axios'
import env from '../../config/common'

export default {
  // 获取sms
  getMonthStatList ({ dispatch, commit, state, rootState }, info) {
    const URL = env.CRM_API_HOST + '/admin/' + rootState.auth.user.token + '/sites/' + rootState.auth.site_id + '/list/source/statistics'
    // const URL = 'http://rap2api.taobao.org/app/mock/2717/GET/admin/%7Btoken%7D/sites/%7Bsite_id%7D/list/source/statistics'
    return axios.get(URL + '?' + U(info))
  },
  getTeamMonthStatList ({ dispatch, commit, state, rootState }, info) {
    const URL = env.CRM_API_HOST + '/admin/' + rootState.auth.user.token + '/sites/' + rootState.auth.site_id + '/team/list/source/statistics'
    // const URL = 'http://rap2api.taobao.org/app/mock/2717/GET/admin/%7Btoken%7D/sites/%7Bsite_id%7D/team/list/source/statistics'
    return axios.get(URL + '?' + U(info))
  },
  getMemberMonthStatList ({ dispatch, commit, state, rootState }, info) {
    const URL = env.CRM_API_HOST + '/admin/' + rootState.auth.user.token + '/sites/' + rootState.auth.site_id + '/counselor/list/source/statistics'
    // const URL = 'http://rap2api.taobao.org/app/mock/2717/GET/admin/[token]/sites/[site_id]/counselor/list/source/statistics'
    return axios.get(URL + '?' + U(info))
  },
  getRollQuantityList ({ dispatch, commit, state, rootState }, info) {
    const URL = env.CRM_API_HOST + '/admin/' + rootState.auth.user.token + '/sites/' + rootState.auth.site_id + '/performance/list'
    // const URL = 'http://rap2api.taobao.org/app/mock/2717/GET/admin/[token]/sites/[site_id]/performance/list'
    return axios.get(URL + '?' + U(info))
  },
  getTeamRollQuantityList ({ dispatch, commit, state, rootState }, info) {
    const URL = env.CRM_API_HOST + '/admin/' + rootState.auth.user.token + '/sites/' + rootState.auth.site_id + '/team/performance'
    // const URL = 'http://rap2api.taobao.org/app/mock/2717/GET/admin/[token]/sites/[site_id]/team/performance'
    return axios.get(URL + '?' + U(info))
  },
  getMemberRollQuantityList ({ dispatch, commit, state, rootState }, info) {
    const URL = env.CRM_API_HOST + '/admin/' + rootState.auth.user.token + '/sites/' + rootState.auth.site_id + '/suid/performance'
    // const URL = 'http://rap2api.taobao.org/app/mock/2717/GET/admin/[token]/sites/[site_id]/suid/performance'
    return axios.get(URL + '?' + U(info))
  },
}
